package cn.net.zhenchan.common;


import cn.net.zhenchan.enums.MsgStatus;

import java.io.Serializable;

public class ServiceMessageImpl<T> implements ServiceMessage<T>, Serializable{
	private static final long serialVersionUID = -8097332628744451550L;

	private MsgStatus status;

	private String message;

	private T result;

	public ServiceMessageImpl(T result)
	{
		this.status = MsgStatus.NORMAL;
		this.message = MsgStatus.NORMAL.name();
		this.result = result;
	}

	public ServiceMessageImpl(MsgStatus status, T result)
	{
		this.status = status;
		this.message = status.name();
		this.result = result;
	}
	
	public ServiceMessageImpl(MsgStatus status, String message)
	{
		this.status = status;
		this.message = message;
		this.result = null;
	}

	public ServiceMessageImpl(MsgStatus status, String message, T result)
	{
		this.status = status;
		this.message = message;
		this.result = result;
	}

	public void setStatus(MsgStatus status)
	{
		this.status = status;
	}

	public void setMessage(String message)
	{
		this.message = message;
	}

	public void setResult(T result)
	{
		this.result = result;
	}

	@Override
	public MsgStatus getStatus()
	{
		return status;
	}

	@Override
	public String getMessage()
	{
		return message;
	}

	@Override
	public T getResult()
	{
		return result;
	}
}
